<style>
    .panel-header, .panel-body {
        border-width: 0px;
    }

    .datagrid, .combo-p {
        border: solid 1px #D4D4D4;
    }

    .panel-title {
        cursor: pointer
    }

    .inlineblock {
        margin-top: 10px;
    }

    .inlineblock div {
        display: inline-block;
    }

    .inlineblock div label {
        display: inline-block;
        top: 5px;
    }

    .newform {
        width: 70%;
    }

    .editform {
        width: 70%;
    }

    .searchClass {
        margin-left: 5%;
        margin-top: 1%;
    }

    .searchClass label {
        width: 9%;
        font-weight: bold;
        text-align: center;
    }

    #Search {
        float: right;
        margin-right: 4%;
        width: 14%;
    }
</style>
<div class="row">
    <div id="breadcrumb" class="col-xs-12" style="margin-bottom: 10px">
        <a href="#" class="show-sidebar"> <i class="fa fa-bars"></i>
        </a>
        <ol class="breadcrumb pull-left">
            <li><a href="#">学生管理</a></li>
            <li><a href="#">学生管理</a></li>
        </ol>
    </div>
</div>
<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <div class="box-name">
                    <i class="fa fa-clipboard"></i> <span>学生管理</span>
                </div>
                <div class="box-icons">
                    <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
                    </a> <a class="expand-link"> <i class="fa fa-expand"></i>
                </a> <a class="close-link"> <i class="fa fa-times"></i>
                </a>
                </div>
                <div class="no-move"></div>
            </div>
            <div class="box-content table-responsive" style="padding-top: 15px">




                <!--主信息面板 S-->
                <div class="panel panel-default" style="border: 1px solid #CCC;">
                    <div class="panel panel-default" style="border: 1px solid #CCC; height: auto;">
                        <div class="panel-heading" role="tab" id="headingOne">
                            <h4 class="panel-title" data-toggle="collapse" data-target="#collapseForAdd">
                                功能面板 <span class="fa fa-chevron-down" style="float: right"></span>
                            </h4>
                        </div>

                        <div id="collapseForAdd" class="panel-collapse collapse in" role="tabpanel"
                             aria-labelledby="headingOne">
                            <div class="panel-body">
                                <div class="container-fluid" style="margin-top: 20px;">
                                    <!--操作-->
                                    <div id="operationpanel" class="col-xs-12">
                                        <div class="col-xs-12 btn-menu-top-minus">
                                            <button class="btn btn-primary btn-sm addTeacher">
                                                <i class="fa fa-file-o"></i> 添加老师信息
                                            </button>
                                            <button class="btn btn-primary btn-sm editTeacher">
                                                <i class="fa fa-file-text"></i> 修改老师信息
                                            </button>
                                            <!--<button class="btn btn-danger btn-sm removebook">-->
                                            <!--<i class="fa fa-trash-o"></i> 删除-->
                                            <!--</button>-->
                                        </div>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="panel-heading" role="tab" id="headingTwo">
                        <h4 class="panel-title" data-toggle="collapse" data-target="#collapseForCourseTable">
                            学生管理<span class="fa fa-chevron-down" style="float: right"></span>
                        </h4>
                    </div>
                    <div id="collapseForCourseTable" class="panel-collapse collapse in" role="tabpanel"
                         aria-labelledby="headingTwo">
                        <div class="panel-body" style="overflow: hidden;">
                            <!--搜索区域-->
                            <div class="searchClass row">
                                <div class="col-xs-12">
                                    <label>昵称</label>
                                    <input class="SearchForm form-control" type="text" id="tea_username"/>
                                    <label>手机号</label>
                                    <input class="SearchForm form-control" type="text" id="tea_phone"/>
                                </div>
                            </div>
                            <!--<div class="searchClass row">-->
                            <!--<div class="col-xs-12">-->
                            <!--<label>日期</label>-->
                            <!--<input class="SearchForm form-control" type="text" id="start" readonly/>-->
                            <!--至&nbsp;&nbsp;&nbsp;-->
                            <!--<input class="SearchForm form-control" type="text" id="end" readonly/>-->
                            <!--</div>-->
                            <!--</div>-->
                            <button id="Search" class="btn btn-primary btn-xs" style="height: 30px;margin-left: 30px">
                                <i class="fa fa-search"></i>&nbsp;&nbsp;搜索
                            </button>
                            <button id="Reset" class="btn btn-primary btn-sm" style="width:120px;float: right;">
                                清空查询条件
                            </button>
                            <button id="enables" class="btn btn-primary btn-sm" style="width:120px;float: right;margin:0px 30px">
                                启用全部
                            </button>
                            <button id="disables" class="btn btn-primary btn-sm" style="width:120px;float: right;">
                                停用全部
                            </button>
                        </div>
                        <table id="datatable_teacherinfo" data-size="15" style="width: 100%">
                        </table>
                    </div>
                </div>
                <!--主信息面板 E-->
            </div>
        </div>
    </div>
</div>
<script src="static/js/ajax/teachermanage.js"></script>
<script>

    /***
     * 停用
     */
    function TyInfo(c) {
        var cid = c.name;
        if(confirm('确认停用此教师吗？')){
            $.ajax({
                url: 'admin/Teacher/disabledTeacher',
                data: 'cid=' + cid,
                type: 'POST',
                dataType: 'JSON',
                success: function (returnData) {
                    if (returnData.status == 0) {
                        layer.msg(returnData.msg,{icon:5,time:2000});
                    } else {
                        layer.msg(returnData.msg,{icon:6,time:2000});
                        $('#datatable_teacherinfo').datagrid('reload');
                    }
                },
                error: function () {
                    $.TeachDialog({
                        content: '系统异常，请联系管理员',
                    });
                },

            });
        }
    }

    /***
     * 启用
     */
    function QyInfo(c) {
        var cid = c.name;
        if(confirm('确认启用此教师吗？')){
            $.ajax({
                url: 'admin/Teacher/enableTeacher',
                data: 'cid=' + cid,
                type: 'POST',
                dataType: 'JSON',
                success: function (returnData) {
                    if (returnData.status == 0) {
                        layer.msg(returnData.msg,{icon:5,time:2000});
                    } else {
                        layer.msg(returnData.msg,{icon:6,time:2000});
                        $('#datatable_teacherinfo').datagrid('reload');
                    }
                },
                error: function () {
                    $.TeachDialog({
                        content: '系统异常，请联系管理员',
                    });
                },

            });
        }
    }

    /**
     * 启用全部
     */
    $('#enables').click(function(){
        if(confirm('确认启用所有教师吗？')){
            $.ajax({
                url: 'admin/Teacher/enableallTeacher',
                data: "",
                type: 'POST',
                dataType: 'JSON',
                success: function (returnData) {
                    if (returnData.status == 0) {
                        layer.msg(returnData.msg,{icon:5,time:2000});
                    } else {
                        layer.msg(returnData.msg,{icon:6,time:2000});
                        $('#datatable_teacherinfo').datagrid('reload');
                    }
                },
                error: function () {
                    $.TeachDialog({
                        content: '系统异常，请联系管理员',
                    });
                },

            });
        }
    })

    /**
     * 停用全部
     */
    $('#disables').click(function(){
        if(confirm('确认停用所有教师吗？')){
            $.ajax({
                url: 'admin/Teacher/disableallTeacher',
                data: "",
                type: 'POST',
                dataType: 'JSON',
                success: function (returnData) {
                    if (returnData.status == 0) {
                        layer.msg(returnData.msg,{icon:5,time:2000});
                    } else {
                        layer.msg(returnData.msg,{icon:6,time:2000});
                        $('#datatable_teacherinfo').datagrid('reload');
                    }
                },
                error: function () {
                    $.TeachDialog({
                        content: '系统异常，请联系管理员',
                    });
                },

            });
        }
    })

    /**
     * 权限
     */
    function contrlInfo(c) {
        var cid = c.name;
        var content = "";
        $.ajax({
            url: 'super/Management/usercontrol',
            data: 'cid=' + cid,
            type: 'POST',
            dataType: 'HTML',//返回的数据类型
            success: function (updatemodalhtml) {
                content = updatemodalhtml;
                //弹出添加框
                $.TeachDialog({
                    title: '用户权限',
                    content: content,
                    largeSize: true,
                    showCloseButton: true,
                    showCloseButtonName: '关闭',
                    otherButtons: ['保存'],
                    otherButtonStyles: ['btn-primary'],
                    clickButton: function (sender, modal, index) {
                        var formData = new FormData($("#updateForm" )[0]);
                        $.ajax({
                            url: 'super/Management/permissioninsert',
                            data: formData,
                            type: 'POST',
                            dataType: 'JSON',
                            async: false,
                            cache: false,
                            contentType: false,
                            processData: false,
                            success: function (returnData) {
                                if (returnData.status == 0) {
                                    $.TeachDialog({

                                        content: returnData.msg
                                    });
                                } else {
                                    modal.modal('hide');
                                    $.TeachDialog({
                                        content: returnData.msg
                                    });
                                    $('#datatable_noticeinfo').datagrid('reload');
                                }
                            },
                            error: function () {
                                $.TeachDialog({
                                    content: '系统异常，请联系管理员',
                                });
                            },

                        });

                    },
                });
            },
            error: function () {
                $.TeachDialog({
                    content: '系统异常，请联系管理员',
                });
                return;
            }
        });
    }

    /**
     * 修改
     * @param c
     */
    function updateInfo(c) {
        var content = "";
        var user_id = c.name;
        $.ajax({
            url: 'super/Management/updateuser',
            data: "nid=" + user_id,
            type: 'POST',
            dataType: 'HTML',//返回的数据类型
            success: function (updatemodalhtml) {
                content = updatemodalhtml;
                //弹出修改框
                $.TeachDialog({
                    title: '修改用户信息',
                    content: content,
                    showCloseButton: true,
                    showCloseButtonName: '关闭',
                    otherButtons: ['保存'],
                    otherButtonStyles: ['btn-primary'],
                    clickButton: function (sender, modal, index) {
                        var formData = new FormData($("#updateForm")[0]);
                        $.ajax({
                            url: 'super/Management/changeuser',
                            data: formData,
                            type: 'POST',
                            dataType: 'JSON',
                            async: false,
                            cache: false,
                            contentType: false,
                            processData: false,
                            success: function (returnData) {
                                if (returnData.status == 0) {
                                    layer.open({
                                        content: returnData.msg
                                    });
                                } else {
                                    $.TeachDialog({
                                        content: returnData.msg
                                    });
                                    modal.modal('hide');
                                    $('#datatable_noticeinfo').datagrid('reload');
                                }
                            },
                            error: function () {
                                $.TeachDialog({
                                    content: '系统异常，请联系管理员'
                                });
                            },

                        });

                    },
                });
            },
            error: function () {
                $.TeachDialog({
                    content: '系统异常，请联系管理员'
                });
                return;
            }
        });
    }
</script>